#include <vector>
#include <iostream>
#include <sstream>
#include <sys/time.h>
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>


#include "tcpImpl.h"


std::string gettimestamp(){
	char buff[100]="";
	struct timeval tv;	
	gettimeofday(&tv,NULL);	
	sprintf(buff,"%d.%d.txt",tv.tv_sec,tv.tv_usec);
	return string(buff);
	
}


bool tcpimpl::handle( std::string instr,std::string & outstr){
	FILE * fp =fopen(gettimestamp().c_str(),"w");	
	if(fp==NULL){
		std::cout<<"fp is null"<<endl;
		return false;
	}
	fwrite(instr.c_str(),instr.size(),1,fp);
	fclose(fp);
	
	std::cout<<getpid()<<instr<<endl;
	outstr=instr;
	return true;
}



